Skip to content

fix(seer): show GitLab icon for GitLab SCM links in evidence UI#118055

Merged
billyvg merged 4 commits into
masterfrom
billyvong/cw-1528-gitlab-scm-icon-fix
Jun 22, 2026
Merged

fix(seer): show GitLab icon for GitLab SCM links in evidence UI#118055
billyvg merged 4 commits into
masterfrom
billyvong/cw-1528-gitlab-scm-icon-fix

Conversation

@billyvg

@billyvg billyvg commented Jun 18, 2026

Copy link
Copy Markdown
Member

Problem

git_search tool links hardcoded <IconGithub /> for all SCM providers.

Change

Reads params.provider (e.g. 'integrations:gitlab') from the tool link params and passes it to getScmIcon(). Returns <IconGitlab /> for GitLab, <IconGithub /> for everything else.

Using the explicit provider string (rather than URL hostname sniffing) means this works correctly for self-hosted GitLab instances whose domain doesn't contain 'gitlab'.

Depends on getsentry/seer#7031 which adds provider to the git_search tool link params.

Companion backend fix: #118054

Fixes https://linear.app/getsentry/issue/CW-1528


View Session in Sentry

git_search tool links hardcoded <IconGithub /> for all providers.
Adds getScmIcon(url) that inspects the URL hostname and returns
<IconGitlab /> for GitLab domains, falling back to <IconGithub />.

Fixes CW-1528

Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

CW-1528

billyvg added a commit that referenced this pull request Jun 18, 2026
Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 18, 2026
Use params.provider (e.g. 'integrations:gitlab') instead of
hostname sniffing to pick the right icon. The URL-based approach
breaks for self-hosted GitLab instances whose domain doesn't
contain 'gitlab'.

Depends on getsentry/seer#7031 adding provider to the tool link params.

Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.73% 93.73% ±0%
Typed 133,326 133,326 ±0
Untyped 8,917 8,918 🔴 +1
🔍 1 new type safety issue introduced

any-typed symbols (1 new)

File Line Detail
static/app/components/events/autofix/v3/autofixEvidence.tsx 323 provider (var(binding))

This is informational only and does not block the PR.

if (provider === 'integrations:gitlab') {
return <IconGitlab />;
}
return <IconGithub />;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for old explorer runs we won;t have provider so im keeping github as the default

Reorder destructured keys to match the formatter's canonical output so
the pre-commit `format` hook passes in CI. No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@billyvg billyvg marked this pull request as ready for review June 19, 2026 16:57
@billyvg billyvg requested a review from a team as a code owner June 19, 2026 16:57
@billyvg billyvg requested review from a team and ryan953 June 19, 2026 16:57
Comment thread static/app/components/events/autofix/v3/autofixEvidence.tsx
Comment on lines +314 to +317
if (provider === 'integrations:gitlab') {
return <IconGitlab />;
}
return <IconGithub />;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RepoProviderIcon might be a good import for here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect thanks

return {
href: commit_url,
icon: <IconGithub />, // TODO: support other SCMs
icon: <RepoProviderIcon provider={provider ?? 'integrations:github'} />,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The nullish coalescing operator for the provider parameter doesn't handle empty strings, causing a generic icon to be displayed instead of the intended default GitHub icon.
Severity: LOW

Suggested Fix

Replace the nullish coalescing operator with a more robust check to ensure provider is a non-empty string before use. For example: (provider && typeof provider === 'string') ? provider : 'integrations:github'. This will correctly handle null, undefined, and empty string cases by falling back to the default.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/components/events/autofix/v3/autofixEvidence.tsx#L329

Potential issue: The code uses `provider ?? 'integrations:github'` to set a default
value for the `provider` parameter. The nullish coalescing operator (`??`) only provides
a fallback for `null` or `undefined` values, not for an empty string (`""`). If the
backend sends an empty string for `provider`, it will be passed to the
`RepoProviderIcon` component. This component will not find `""` as a valid provider,
will log an error, and will render a generic `<IconOpen />` icon instead of the intended
default GitHub icon, leading to a degraded user experience.

Also affects:

  • static/app/components/events/autofix/v3/autofixEvidence.tsx:345~345

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should never be an empty string

@billyvg billyvg merged commit cf862ca into master Jun 22, 2026
71 checks passed
@billyvg billyvg deleted the billyvong/cw-1528-gitlab-scm-icon-fix branch June 22, 2026 14:56
billyvg added a commit that referenced this pull request Jun 22, 2026
## Problem

For GitLab repos, `repo.name` is `name_with_namespace` — the
human-readable display name, e.g. `"My Group / My Project"` (spaces
around the slash). Splitting this on `/` to extract `owner` and `name`
produces parts with leading/trailing whitespace, which causes Seer to
construct SCM links that 404.

Root cause confirmed by comparing the GitLab integration's own
`format_source_url`, which already uses `repo.config["path"]`
(`path_with_namespace`, e.g. `"my-group/my-project"`) to build valid
URLs.

## Changes

**Introduce `get_repo_url_path(repo)` helper** in
`seer/autofix/utils.py`:
- Returns `repo.config["path"]` for `integrations:gitlab` repos
(URL-safe `path_with_namespace`).
- Returns `repo.name` unchanged for GitHub and all other providers.

Applied at the four call sites that previously did
`repo.name.split("/")`:
- `seer/autofix/utils.py` — `build_repo_definition_from_project_repo`
and `get_autofix_repos_from_project_code_mappings`
- `seer/endpoints/project_seer_repos.py` — `_serialize_project_repo`
- `seer/agent/tools.py` — `get_repository_definition`


Companion frontend fix (icon): #118055

Fixes https://linear.app/getsentry/issue/CW-1528

---
[View Session in
Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC013P75SQUB%3A1781810595.615099%22)

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants